import Vue from 'vue'
import App from './App'

import store from './store'
Vue.prototype.$store = store

import $H from './static/common/request.js';
Vue.prototype.$H = $H

import $G from './static/common/global.js';
Vue.prototype.$G = $G

import uView from "uview-ui";
Vue.use(uView);

Vue.prototype.authJump = (options)=>{
	if(!store.state.token){
		uni.showToast({
			title: '请先登录',
			icon: 'none'
		});
		return uni.navigateTo({
			url:'/pages/login/login'
		});
	}
	uni.navigateTo(options);
}

Vue.prototype.authMethod = (callback)=>{
	if(!store.state.token){
		uni.showToast({
			title: '请先登录',
			icon: 'none'
		});
		return uni.navigateTo({
			url:'/pages/login/login'
		});
	}
	callback()
}

// #ifndef VUE3
import './uni.promisify.adaptor'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
  store,
  	...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif